ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Communication / SCP functions
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
<sshSession variable>.SCPGetFile (Function)
In french: <Variable sshSession>.SCPRécupèreFichier
Gets a file via the Secure Copy Protocol.
Reminder: The Secure Copy Protocol (SCP) is a protocol for secure data transfer between a local host and a remote host or between two remote hosts. This protocol is based on an SSH connection.
Example
// Set up SSH session
SSHSession is sshSession
SSHSession.Address = "myserver.com"
SSHSession.Port = 22
SSHSession.User = "username"
SSHSession.UserPassword = "password"
SSHSession.ConnectionTimeout = 2s
 
sFileName is string = "accounting_january.docx"
// File path on the local host
sLocalFilePath is string = fExeDir() + [fSep()] + sFileName
// File path on the remote host (Linux in this case)
sRemoteFilePath is string = "~/accounting/" + sFileName
 
// Get the file using SCP
IF NOT SSHSession.SCPGetFile(sRemoteFilePath, ...
sLocalFilePath, Progress) THEN
Error(ErrorInfo(errFullDetails))
ELSE
Info("File successfully retrieved")
END
 
 
// Progress monitoring (optional procedure)
INTERNAL PROCEDURE Progress(nTotalSize, nCurrentSize)
Trace(nCurrentSize + "/" + nTotalSize)
END
Syntax
<Result> = <SSH connection>.SCPGetFile(<Remote file> , <Local file> [, <WLanguage procedure>])
<Result>: Boolean
  • True if the file has been retrieved,
  • False otherwise. The error status report is returned by ErrorInfo.
<SSH connection>: sshSession variable
Name of the sshSession variable used to get the file.
<Remote file>: Character string
Name and full (or relative) path of the file on the remote host.
<Local file>: Character string
Name and full (or relative) path of the file to be retrieved on the local host using the Secure Copy Protocol.
<WLanguage procedure>: Optional procedure name
Name of the WLanguage procedure ("callback") called when getting the file. This procedure gets the progress of the file transfer.
Business / UI classification: Business Logic
Component: wd290com.dll
Minimum version required
  • Version 28
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 01/03/2023

Send a report | Local help